<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
		<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
		<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
		<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
		<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
		<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
		<title>车辆二维码列表</title>
	</head>

	<body>
		
		<article class="page-container">
			<div class="text-c">
				<input type="text" name="" id="start_id" maxlength="8" placeholder=" 起始编号" style="width:180px" class="input-text"> -
				<input type="text" name="" id="stop_id"maxlength="8" placeholder=" 终止编号" style="width:180px" class="input-text">
			</div>
			
			<div class="text-c">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>状态：</label>
				<div class="formControls col-xs-8 col-sm-4 skin-minimal">
					<div class="radio-box">
						<input name="status" type="radio"  value='1' id="status-1" checked>
						<label for="sex-1">启用</label>
					</div>
					<div class="radio-box">
						<input type="radio" id="status-2"  value='0' name="status">
						<label for="sex-2">停用</label>
					</div>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
<!-- 					<button name="" id="" class="btn btn-success" type="submit" onclick="submitall();">生成</button>(如：B000000~B999999)
 -->					<input class="btn btn-primary radius" type="button" onclick="submitall()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">(如：B000000~B999999)
					
<!-- 					<input class="btn btn-primary radius" type="button" onclick="saveOffice()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
 -->				</div>
			</div>
		</article>
		
		

			
			

			
		<!--_footer 作为公共模版分离出去-->
		<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
		<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
		<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
		 <script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> 
		<!--/_footer 作为公共模版分离出去-->

		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
		<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
		<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
		<script type="text/javascript" src="js/jquery.base64.js"></script>
		<script type="text/javascript">
			//排序
			var urlsVehicleqrcode = 'http://39.100.91.49:8000/vehicleqrcode/';
			//var urlsVehicleqrcode = '/apis/base/vehicleqrcode/';
			//var urlsVehicleqrcode = 'http://192.168.1.106:8000/vehicleqrcode/';
			//var urlsVehicleqrcode = '/apis/base/vehicleqrcode/'
			//var urlsVehicleqrcode = 'http://192.168.1.106:8000/vehicleqrcode/'
			
			$(function() {
			
			})

			function submitall() {
				var obj = document.getElementsByName("status");
				var vehicleStatus = "";
				    for(var i=0; i<obj.length; i ++){
				        if(obj[i].checked){
						   vehicleStatus=obj[i].value
				        }
				    }
				//var userinfo = 	window.localStorage.getItem("userinfo");
				var userinfo = getUserInfo();
				var username =userinfo.username;
				var start_id = $("#start_id").val();
				var stop_id = $("#stop_id").val();
				var reg = /^[B][B0-9_]*$/;
				if(!reg.test(start_id) || start_id.length > 8) {
					alert("起始编号输入有误，请核对后重新输入");
					return;
				}
				if(!reg.test(stop_id) || stop_id.length > 8) {
					alert("终止编号输入有误，请核对后重新输入");
					return;
				}
				//判断是否已经存在
				var flag = false;
				$.ajax({
					type: 'post',
					url: urlsVehicleqrcode + "isStrIncloudOfList",
					data: {
						"startNum": start_id,
						"stopNum": stop_id,
						"vehicleStatus":vehicleStatus,
						"username":username
					},
					async: false, // 同步
					cache: false,
				/* 	beforeSend: function(request) {
						request.setRequestHeader("Authorization", "Bearer " + getToken());
					}, */
					dataType: 'json',
					success: function(data) {
						console.log(data)
					  	if(data.status == "0") {
							//flag = true;
							layer.msg('添加成功!',{icon:1,time:1000});
						} else { 
							layer.msg(data.status+'!',{icon:2,time:1000});
						} 
						/* var index = parent.layer.getFrameIndex(window.name);
						parent.$('.btn-refresh').click();
						parent.layer.close(index); */
					},
					error: function() {
						//alert("请求失败");
					}
				});
				/* if(flag == true) {
					$.ajax({
						type: 'post',
						url: urlsVehicleqrcode + "insert",
						data: {
							"startNum": start_id,
							"stopNum": stop_id
						},
						cache: false,
						beforeSend: function(request) {
							request.setRequestHeader("Authorization", "Bearer " + getToken());
						},
						dataType: 'json',
						success: function(data) {
							if(data.status == true) {
								document.location.reload();
							}
							console.log("-=====>>>>" + data)
						},
						error: function() {
							//alert("请求失败");
						}
					});
				} */

			}
		</script>
	</body>

</html>